texthistory: add GtkTextHistory helper
authorChristian Hergert <chergert@redhat.com>
Thu, 24 Oct 2019 02:13:11 +0000 (19:13 -0700)
committerChristian Hergert <chergert@redhat.com>
Tue, 5 Nov 2019 17:34:29 +0000 (09:34 -0800)
commit5e341210a1cfa08a34cb257039416a97a0ab4929
tree6d5777a28391bc0744640bd10f0efa0f1dc096c3
parentfbea677a5c6948684317f872bc6740f3c03e4b3b
texthistory: add GtkTextHistory helper

The GtkTextHistory helper provides the fundamental undo/redo stack that
can be integrated with other text widgets. It allows coalescing related
actions to reduce both the number of undo actions to the user as well as
the memory overhead.

A new istring helper is used by GtkTextHistory to allow for "inline
strings" that gracefully grow to using allocations with g_realloc(). This
ensure that most undo operations require no additional allocations other
than the struct for the action itself.

A queue of undoable and redoable actions are maintained and the link for
the queue is embedded in the undo action union. This allows again, for
reducing the number of allocations involved for undo operations.
gtk/gtkistringprivate.h [new file with mode: 0644]
gtk/gtktexthistory.c [new file with mode: 0644]
gtk/gtktexthistoryprivate.h [new file with mode: 0644]
gtk/meson.build
tests/meson.build
tests/testtexthistory.c [new file with mode: 0644]